package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.HaAppiontment;
import com.ruoyi.system.service.IHaAppiontmentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 预约列表Controller
 * 
 * @author 鲍小伟
 * @date 2025-11-12
 */
@RestController
@RequestMapping("/system/appiontment")
public class HaAppiontmentController extends BaseController
{
    @Autowired
    private IHaAppiontmentService haAppiontmentService;

    /**
     * 查询预约列表列表
     */
    @PreAuthorize("@ss.hasPermi('system:appiontment:list')")
    @GetMapping("/list")
    public TableDataInfo list(HaAppiontment haAppiontment)
    {
        startPage();
        List<HaAppiontment> list = haAppiontmentService.selectHaAppiontmentList(haAppiontment);
        return getDataTable(list);
    }

    /**
     * 导出预约列表列表
     */
    @PreAuthorize("@ss.hasPermi('system:appiontment:export')")
    @Log(title = "预约列表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HaAppiontment haAppiontment)
    {
        List<HaAppiontment> list = haAppiontmentService.selectHaAppiontmentList(haAppiontment);
        ExcelUtil<HaAppiontment> util = new ExcelUtil<HaAppiontment>(HaAppiontment.class);
        util.exportExcel(response, list, "预约列表数据");
    }

    /**
     * 获取预约列表详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:appiontment:query')")
    @GetMapping(value = "/{aid}")
    public AjaxResult getInfo(@PathVariable("aid") Long aid)
    {
        return success(haAppiontmentService.selectHaAppiontmentByAid(aid));
    }

    /**
     * 新增预约列表
     */
    @PreAuthorize("@ss.hasPermi('system:appiontment:add')")
    @Log(title = "预约列表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HaAppiontment haAppiontment)
    {
        return toAjax(haAppiontmentService.insertHaAppiontment(haAppiontment));
    }

    /**
     * 修改预约列表
     */
    @PreAuthorize("@ss.hasPermi('system:appiontment:edit')")
    @Log(title = "预约列表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HaAppiontment haAppiontment)
    {
        return toAjax(haAppiontmentService.updateHaAppiontment(haAppiontment));
    }

    /**
     * 删除预约列表
     */
    @PreAuthorize("@ss.hasPermi('system:appiontment:remove')")
    @Log(title = "预约列表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{aids}")
    public AjaxResult remove(@PathVariable Long[] aids)
    {
        return toAjax(haAppiontmentService.deleteHaAppiontmentByAids(aids));
    }
}
